﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Mag.Model.Organization>" %>
<%@ Import Namespace="SDT.Lib.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Sửa
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="Header" runat="server">
	Đơn vị
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Toolbar" runat="server">
	<%= Html.Toolbar("Xóa", string.Format("/Organization/Delete/{0}", Model.ID), "delete")%>
	<%= Html.Toolbar("Quay lại", "/Organization", "back")%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%if(ViewData["MessageInfo"]==null){ %>
    <% using (Html.BeginForm("Edit", "Organization", FormMethod.Post, new { id = "adminForm" } )) {%>
        <%= Html.ValidationSummary(true) %>     
        <fieldset>
            <legend>Sửa</legend>
            <font color="red">*</font> là trường bắt buộc phải nhập.
			<table class="admintable">
				<tbody><tr>
					<td class="key">Mã đơn vị (<font color="red">*</font>)</td>
					<td>
						<%= Html.TextBoxFor(model => model.Code, new { @class = "required title", maxlength = 10 })%>
						<%= Html.ValidationMessageFor(model => model.Code) %>
					</td>
				</tr>
				<tr>
					<td class="key">Tên đơn vị (<font color="red">*</font>)</td>
					<td>
						<%= Html.TextBoxFor(model => model.Name, new { @class = "required title", maxlength = 250 })%>
						<%= Html.ValidationMessageFor(model => model.Name) %>
					</td>
				</tr>
				<tr>
					<td class="key">Mô tả</td>
					<td>
						<%= Html.TextAreaFor(model => model.Description, new { rows = 4, @class = "description" })%>
						<%= Html.ValidationMessageFor(model => model.Description)%>
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center"><input type="submit" value="Lưu" /></td>
				</tr></tbody>
			 </table>
        </fieldset>
		<%= Html.HiddenFor(model => model.ID)%>
    <% } %>
    <script type="text/javascript">
		$(document).ready(function() {
			$("#adminForm").validate({
				rules: {
					Code: "required",
					Name: "required"
				},
				messages: {
					Code: "Trường này là bắt buộc, vui lòng nhập dữ liệu!" ,
					Name: "Trường này là bắt buộc, vui lòng nhập dữ liệu!" 
				}
			});
		});
	</script>
<% } %>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="Message" runat="server">
    <%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%> 
</asp:Content>
